<ui:decorate xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	template="template/kmsTemplate.xhtml">

	<ui:define name="kmsTitle">
		<ui:include src="template/kmsTop.xhtml" />
	</ui:define>

	<ui:define name="kmsMenu">
		<ui:include src="template/kmsLeftMenu.xhtml" />
	</ui:define>

	<ui:define name="kmsBody">
		<h:form>
			<h:panelGrid columns="2">
				<h:outputText value="#{kmsMsg.title}" />
				<h:inputText style=" width : 333px;" value="#{kmsArticleBean.kmsArticle.title}" />
	
				<h:outputText value="#{kmsMsg.kmsKnowledge}" />
				<h:selectOneMenu style="width:301px" value="#{kmsArticleBean.kmsKnowledgeId}">
					<f:selectItems value="#{knowledgeItems.items}"/>
				</h:selectOneMenu>
	
				<h:outputText value="#{kmsMsg.summary}" />
				<h:inputTextarea style=" width : 633px; height : 138px;" value="#{kmsArticleBean.kmsArticle.summary}" rows="8" cols="2"/>
	
				<h:outputText value="#{kmsMsg.content}" />
				<rich:editor id="content_editor" theme="advanced" value="#{kmsArticleBean.kmsArticle.content}" 
				width="800" height="468" skin="o2k7">
					<f:param name="theme" value="advanced"/>
					<f:param name="plugins" value="save,paste"/>
					<f:param name="theme_advanced_toolbar_location" value="top"/>
					<f:param name="theme_advanced_toolbar_align" value="left"/>
					<f:param name="theme_advanced_resizing" value="true"/>
				</rich:editor>
	
				<h:outputText value="#{kmsMsg.attachment}" />
				
				<h:panelGrid columns="2" style="width:50%;margin:0;padding:0">
					<rich:fileUpload id="upload"
						fileUploadListener="#{kmsArticleBean.uploader.listener}"
						maxFilesQuantity="#{kmsArticleBean.uploader.uploadsAvailable}"					
						immediateUpload="#{kmsArticleBean.uploader.autoUpload}"
						allowFlash="#{kmsArticleBean.uploader.useFlash}"
						listHeight="0"
						listWidth="100%">
						<a4j:support event="onuploadcomplete" reRender="attachmentInfo" />
					</rich:fileUpload>
					
					<h:panelGroup id="attachmentInfo">
						<rich:panel>
							<h:outputText value="#{kmsMsg.nofileNotification}" rendered="#{kmsArticleBean.uploader.size==0}" />
											
							<rich:dataGrid columns="1" value="#{kmsArticleBean.uploader.files}" var="file">
								<rich:panel bodyClass="rich-laguna-panel-no-header">
									<h:outputText value="#{file.name} (#{file.length} bytes)" />					
								</rich:panel>
							</rich:dataGrid>
						</rich:panel>
	
						<a4j:commandButton action="#{kmsArticleBean.uploader.clearUploadData}" 
							reRender="attachmentInfo, upload" value="#{kmsMsg.clearUpdata}" rendered="#{kmsArticleBean.uploader.size>0}" />
					</h:panelGroup>
				</h:panelGrid>
				
			</h:panelGrid>
				
			<h:commandButton  id="updateButton" styleClass="kms-normal-button" value="#{kmsMsg.update}" action="#{kmsArticleBean.update}"/>
		</h:form>
	</ui:define>

	<ui:define name="kmsBottom">
		<ui:include src="template/kmsBottom.xhtml" />
	</ui:define>
</ui:decorate>
